

#include<stdio.h>
typedef struct stud {
    int num;
    char name[10];
    int score[3];
    int sum;
}Stu;

void My_scanf(Stu stu[], int N, int* sz) {
    while (N--) {
        scanf("%d%s%d%d%d", &(stu[*sz].num), stu[*sz].name, &(stu[*sz].score[0]), &(stu[*sz].score[1]), &(stu[*sz].score[2]));
        stu[*sz].sum = stu[*sz].score[0] + stu[*sz].score[1] + stu[*sz].score[2];
        (*sz)++;
    }
    return;
}
void My_printf(Stu stu[], int sz) {
    int all_sum = 0;
    int count = sz;
    int temp_sz = 0;
    int max_pos = 0;
    while (temp_sz < sz) {
        all_sum += stu[temp_sz].sum;
        if (stu[temp_sz].sum > stu[max_pos].sum)
            max_pos = temp_sz;
        printf("%d %s %d %d %d %d\n", stu[temp_sz].num, stu[temp_sz].name, stu[temp_sz].score[0], stu[temp_sz].score[1], stu[temp_sz].score[2], stu[temp_sz].sum);
        temp_sz++;
    }

    printf("总平均分=%lf\n", 1.0 * all_sum / (3 * count));
    printf("%d %s %d %d %d %d\n", stu[max_pos].num, stu[max_pos].name, stu[max_pos].score[0], stu[max_pos].score[1], stu[max_pos].score[2], stu[max_pos].sum);
}
int main() {
    Stu stu[100] = { 0 };
    int N;
    scanf("%d", &N);
    while (!(N >= 0 && N <= 10))
        scanf("%d", &N);
    int sz = 0;
    My_scanf(stu, N, &sz);//输入
    My_printf(stu, sz);//输出
}